import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/components/login')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/components/home'),
    redirect: '/info',
    children: [
      {
        // 店铺基础信息组件
        path: '/info',
        component: () => import('@/components/store/shop-info')
      },
      {
        // 店铺风格管理组件
        path: '/style',
        component: () => import('@/components/store/shop-style')
      },
      {
        // 店铺权益组件
        path: '/right',
        component: () => import('@/components/store/shop-right')
      },
      {
        // 优惠券管理组件
        path: '/preferential',
        component: () => import('@/components/goods/preferential')
      },
      {
        // 活动设置组件
        path: '/activity',
        component: () => import('@/components/goods/goods-activity')
      },
      {
        // 商品列表组件
        path: '/list',
        component: () => import('@/components/goods/goods-list')
      },
      {
        // 商品分类组件
        path: '/cate',
        component: () => import('@/components/goods/goods-cate')
      },
      {
        // 订单列表组件
        path: '/order',
        component: () => import('@/components/order/order')
      },
      {
        // 店铺账户组件
        path: '/shopAccount',
        component: () => import('@/components/money/shop-account')
      },
      {
        // 账户明细组件
        path: '/account',
        component: () => import('@/components/money/account')
      },
      {
        // 我的素材库组件
        path: '/material',
        component: () => import('@/components/material/my-material')
      },
      {
        // 素材商城组件
        path: '/goods',
        component: () => import('@/components/material/material-goods')
      },
      {
        // 素材商城组件
        path: '/map/:id',
        component: () => import('@/components/order/components/map'),
        props: true
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
